import $http from '../../../servers/http';
import { Result } from 'seats/schema/Result';

const BASE_URL = '/weathersms/web/industry';

/** 查询机构下拉框 */
export const getOrganTree = (data): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/configorganizational/select`,
    data,
  });
};

/**短信群发*/
export const massSendInfo = (data: any): Promise<Result<any>> => {
  return $http.post({
    url: `${BASE_URL}/smshangmain/save`,
    data,
  });
};

/**查询签名下拉框*/
export const getSignatureList = (): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/smsshanmsgsign/select`,
  });
};

/**查询当前用户能否切换短信模板*/
export const judgeIndustryCanEdit = (): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/user/info`,
  });
};

/**回复记录列表*/
export const getRecordList = (data: any): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/smshangphone/replylist`,
    data,
  });
};

/**通讯录 */
export const industryIpaApi = {
  // 建组
  createGroup: (data: any): Promise<Result<any>> =>
    $http.post({
      url: `${BASE_URL}/sysContactGroup/save`,
      data,
    }),
  // 组树
  readGroupTree: (): Promise<Result<any>> =>
    $http.get({
      url: `${BASE_URL}/sysContactGroup/list`,
    }),
  // 删组
  deleteGroup: (data: any): Promise<Result<any>> =>
    $http.post({
      url: `${BASE_URL}/sysContactGroup/remove`,
      data,
    }),
  // 创建|修改人
  createPerson: (data: any): Promise<Result<any>> =>
    $http.post({
      url: `${BASE_URL}/sysContact/save`,
      data,
    }),
  // 人员列表
  readPerson: (data: any): Promise<Result<any>> =>
    $http.get({
      url: `${BASE_URL}/sysContact/list`,
      data,
    }),
  // 删除人员
  deletePerson: (data: any): Promise<Result<any>> =>
    $http.post({
      url: `${BASE_URL}/sysContact/remove`,
      data,
    }),
};

/**模板列表*/
export const getTemplateList = (data: any): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/smsTemplateShow/list`,
    data,
  });
};

/**发送记录列表*/
export const getSendList = (data: any): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/smshangphone/sendlist`,
    data,
  });
};

/**批次记录列表*/
export const getBatchList = (data: any): Promise<Result<any>> => {
  return $http.get({
    url: `${BASE_URL}/smshangmain/list`,
    data,
  });
};
